package com.beanu.arad.base.my_base;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;

import com.beanu.arad.base.BaseModel;
import com.beanu.arad.base.BasePresenter;
import com.beanu.arad.utils.NetworkUtils;

/**
 * Created by Administrator on 2018/3/23.
 */
public abstract class MyWebBaseActivity<T extends BasePresenter, E extends BaseModel> extends MyBaseActivity<T, E> {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    protected void onResume() {
        super.onResume();

        if (NetworkUtils.isConnected()) {//网络已连接:加载内容页面
//            if (null != progressLayout) {
//                showContent(null);
//            }
        } else {//网络未连接,显示网络错误页面
            if (null != progressLayout) {
                showError(0, "网络异常", "系统检测到您没有连接到任何网络，请连接网络后点击重新加载。", "重新加载"
                        , new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                reqData();
                            }
                        });
            }
        }
    }

    protected abstract void reqData();//无网络时,点击重试时执行
}
